package com.hp.springioc01;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 电脑
 */
@Component
public class Computer {

    @Value("苹果")
    private String brand;

    @Qualifier("amd")
    @Autowired
    private CPU cpu;

    @Resource
    private Memory sumsungMemory;

    public void start(){
        System.out.println(brand+"品牌的电脑启动了");
        cpu.run();
        sumsungMemory.read();
        sumsungMemory.write();
    }

//    @Override
//    public void xxx(){
//
//    }

    public Computer(String brand, CPU cpu, Memory sumsungMemory) {
        this.brand = brand;
        this.cpu = cpu;
        this.sumsungMemory = sumsungMemory;
    }

    public Computer(CPU cpu, Memory sumsungMemory) {
        this.cpu = cpu;
        this.sumsungMemory = sumsungMemory;
    }

    public Computer() {
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public CPU getCpu() {
        return cpu;
    }

    public void setCpu(CPU cpu) {
        this.cpu = cpu;
    }

    public Memory getSumsungMemory() {
        return sumsungMemory;
    }

    public void setSumsungMemory(Memory sumsungMemory) {
        this.sumsungMemory = sumsungMemory;
    }
}
